﻿@using cloudscribe.Web.Pagination
@using CompanyName.ProjectName.Web.Host
@using CompanyName.ProjectName.Web.Host.Controllers
@using CompanyName.ProjectName.ICommonServer
@using CompanyName.ProjectName.Web.Host.Model
@addTagHelper "*, cloudscribe.Web.Pagination"
@model BaseListViewModel<OperateLogDto>
@{
    Layout = "_Layoutlist";
    OperateLogOption filer = ViewBag.filter as OperateLogOption;

}

@section headers{

}

<!-- Main content -->
<section class="content">

    <div class="row">
        <!-- BEGIN SAMPLE TABLE PORTLET-->
        <div class="col-md-12">
            <!-- BEGIN SAMPLE TABLE PORTLET-->
            <div class="box-body" style="padding-bottom:0px;">
                <!--<div class="panel panel-default">-->

                <div class="search row">
                    <div class="col-sm-12 form-group">
                        <div class="form-inline">
                            <form action="/operateLog/home/index" method="get" id="searchform">

                                <div class="form-group ">
                                    <label class="control-label  label-lg label-md">标签:</label>
                                    @Html.TextBox("Tag", @filer.Tag, new { placeholder = "标签", @class = "form-control input-small input-sm" })
                                </div>

                                <div class="form-group ">

                                    <label class="control-label label-lg label-md">时间:</label>

                                    <input name="StartDateTime" value="@(filer.StartDateTime.HasValue?filer.StartDateTime.Value.ToString("yyyy-MM-dd"):"")" id="StartDateTime" class="form-control input-small input-sm" type="text" placeholder="起始时间" />
                                    -  <input name="EndDateTime" value="@(filer.EndDateTime.HasValue?filer.EndDateTime.Value.ToString("yyyy-MM-dd"):"")" id="EndDateTime" class="form-control input-small input-sm" type="text" placeholder="结束时间" />
                                </div>

                                <span class="form-group btn-group">
                                    <button class="btn btn-sm btn-info" type="submit"><i class="fa fa-search"></i> 搜索</button>
                                </span>
                            </form>
                        </div>
                    </div>
                </div>
                <!--</div>-->

                <div class="table-scrollable">
                    <table class="table table-striped table-bordered table-hover">
                        <thead>
                            <tr class="heading">
                                <th>Id</th>
                                <th>操作者</th>
                                <th>对象表名</th>
                                <th>标签</th>
                                <th>IP</th>
                                <th>内容</th>
                                <th>时间</th>
                            </tr>
                        </thead>
                        <tbody id="tbody">

                            @if (Model.list.Count > 0)
                            {
                                @foreach (var s in Model.list)
                                {
                                    <tr>
                                        <td>@s.Id</td>
                                        <td>@s.OperatorName</td>
                                        <td>@s.ObjectTable</td>
                                        <td>@s.Tag</td>
                                        <td>@s.IP</td>
                                        <td style="width:35%;word-break:break-all;">@s.Content</td>
                                        <td>@(s.CreateTime.ToString("yyyy/MM/dd HH:mm:ss")) </td>
                                    </tr>
                                }
                            }
                        </tbody>
                    </table>
                </div>
                @if (Model.list.Count > 0)
                {
                    <div class="fixed-table-pagination" style="display: block;">
                        <div class="col-sm-4 hidden-xs" style="padding-top:4px;">

                            <span class="pagination-info"> 显示 第 @((Model.Paging.ItemsPerPage * (Model.Paging.CurrentPage - 1)) + 1) 到 @((Model.Paging.ItemsPerPage * Model.Paging.CurrentPage) > Model.Paging.TotalItems ? Model.Paging.TotalItems : (Model.Paging.ItemsPerPage * Model.Paging.CurrentPage)) 条， 共 @Model.Paging.TotalItems 条</span>
                        </div>
                        <div class="col-sm-8 dataTables_paginate;" style="  padding-right:15px; margin-right:0px;">

                            <cs-pager cs-paging-pagesize="@Model.Paging.ItemsPerPage"
                                      cs-paging-pagenumber="@Model.Paging.CurrentPage"
                                      cs-paging-totalitems="@Model.Paging.TotalItems"
                                      cs-pagenumber-param="page"
                                      asp-controller="home"
                                      asp-action="index"
                                      asp-route-Tag="@filer.Tag"
                                      asp-route-StartDateTime="@filer.StartDateTime"
                                      asp-route-EndDateTime="@filer.EndDateTime"
                                      asp-route-pagesize="@Model.Paging.ItemsPerPage"></cs-pager>
                        </div>
                    </div>
                }
            </div>
            <!-- END SAMPLE TABLE PORTLET-->
        </div>
    </div>
</section>

@section scripts{

    <script>
        $(function () {
            if (!jQuery().datetimepicker) {
                return;
            }
            $("#StartDateTime").datetimepicker({
                language: 'zh-CN',
                autoclose: true,
                minView: "month", //选择日期后，不会再跳转去选择时分秒
                format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
                pickerPosition: ("bottom-left")
            });

            $("#EndDateTime").datetimepicker({
                language: 'zh-CN',
                autoclose: true,
                minView: "month", //选择日期后，不会再跳转去选择时分秒
                format: "yyyy-mm-dd", //选择日期后，文本框显示的日期格式
                pickerPosition: ("bottom-left")
            });
        });
    </script>

}